package com.yatop.lambda.base.model;

import com.yuyaogc.lowcode.engine.annotation.Column;
import com.yuyaogc.lowcode.engine.annotation.Id;
import com.yuyaogc.lowcode.engine.annotation.Route;
import com.yuyaogc.lowcode.engine.annotation.Table;
import com.yuyaogc.lowcode.engine.plugin.activerecord.Criteria;
import com.yuyaogc.lowcode.engine.plugin.activerecord.Model;

import java.util.List;

/**
 * 字典类型表
 *
 * @author Lion Li
 */
@Table(name = "base_dict_type")
public class DictType extends Model<DictType> {
    /**
     * 字典主键
     */
    @Id
    private Long id;

    /**
     * 字典名称
     */
    @Column(label = "字典名称")
    private String dictName;

    /**
     * 字典类型
     */
    @Column(label = "字典类型")
    private String dictType;

    /**
     * 状态（0正常 1停用）
     */
    private String status;

    /**
     * 备注
     */
    @Column(label = "备注")
    private String remark;


    @Route
    public  List<DictType> search(Criteria criteria, Integer offset, Integer limit, String order){
      List<DictType> dictTypeList =  DictType.search(DictType.class,criteria, offset, limit, order);
      for(DictType dictType1: dictTypeList){
          dictType1.set("label", dictType1.getDictName());
          dictType1.set("value", dictType1.getDictType());
      }
      return dictTypeList;
    }

    public String getDictName() {
        return (String) this.get("dictName");
    }

    public DictType setDictName(String dictName) {
        this.set("dictName", dictName);
        return this;
    }

    public String getDictType() {
        return (String) this.get("dictType");
    }

    public DictType setDictType(String dictType) {
        this.set("dictType", dictType);
        return this;
    }

    public String getStatus() {
        return (String) this.get("status");
    }

    public DictType setStatus(String status) {
        this.set("status", status);
        return this;
    }

    public String getRemark() {
        return (String) this.get("remark");
    }

    public DictType setRemark(String remark) {
        this.set("remark", remark);
        return this;
    }
}
